The fat-tree topology is used for high performance computing (HPC) clusters, and for clusters based on InfiniBand (IB) technology. For fat-trees, as with most other topologies, the routing algorithm is beneficial for efficient use of the network resources. However, the existing routing algorithms have a limitation when it comes to switch-to-switch communication. None of the existing routing algorithms support deadlock free and fully connected switch-to-switch communication which is beneficial for efficient system management. These are the generally areas that embodiments of the invention are intended to address.